home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu194.dms / pu194.adf / MambaMove / MambaMove.lzh / MambaMove.c < prev    next >
C/C++ Source or Header  |  1991-07-22  |  59KB  |  1,962 lines

  1. #include <exec/memory.h>
  2. #include <intuition/intuition.h>
  3. #include <libraries/dos.h>
  4. #include <graphics/gfx.h>
  5. #include <clib/macros.h>
  6.  
  7.  
  8. #define UP    0
  9. #define RIGHT 1
  10. #define DOWN  2
  11. #define LEFT  3
  12.  
  13. #define HORIZONTAL 4
  14. #define VERTIKAL   8
  15. #define DIAGONAL   12
  16. #define REVERSE    16
  17.  
  18. #define XCOORD 0
  19. #define YCOORD 1
  20. #define DIRECT 2
  21.  
  22. #define NO_FAULT 0L
  23. #define NO_INTUI 1L
  24. #define NO_GRAFX 2L
  25. #define NO_DSCRN 3L
  26. #define NO_ASCRN 4L
  27. #define NO_AWIND 5L
  28.  
  29.  
  30. struct IntuitionBase *IntuitionBase;
  31. struct GfxBase *GfxBase;
  32. struct Screen *DataScreen, *ActionScreen;
  33. struct Window *ActionWindow;
  34. struct RastPort *drp, *arp;
  35. struct ViewPort *avp;
  36.  
  37. int Score, Lives, Level, Apples;
  38. int GrownLength, MambaLength, AnApple;
  39.  
  40. int MambaX, MambaY, MambaDir, NewD;
  41. int MambaHead, MambaTail;
  42.  
  43. int XIn, XOut, YInt, YOut, StartDir;
  44.  
  45. int Time_Elapsed;
  46.  
  47. int am, ax, ay;
  48.  
  49. BYTE *TitleSound;
  50.  
  51. double ran();
  52.  
  53. extern USHORT ClapsSound[1150], PercoSound[2250], ShakerSound[1150];
  54.  
  55.  
  56. /* extern void ClipBlit(), CloseLibrary(), Close(), FreeMem(); */
  57. /* extern void *OpenLibrary(), *AllocMem; */
  58. /* extern struct FileHandle *Open; */
  59.  
  60. UBYTE ScoreName[19]  = "SCORE: ";
  61. UBYTE LivesName[18]  = "MAMBAS: ";
  62. UBYTE ApplesName[18] = "APPLES: ";
  63. UBYTE LevelName[18]  = "LEVEL: ";
  64. UBYTE TLftText[10] = "TIME LEFT";
  65. UBYTE HiScoreHail[18] = "Mamba High Scores";
  66. UBYTE EnterScoreHail[20] = "Enter Your Initials";
  67.  
  68. UBYTE AgainText[36] = "HIT ANY KEY OR JOYSTICK TO CONTINUE";
  69. BYTE PlayGround[40][21], TheMamba[410][3];
  70.  
  71. int WaitIfMoved, WaitIfStruck, WaitIfTurned, WaitIfStraight, WaitOneMove;
  72.  
  73. int ProbOfTime, ProbOfGrowth, ProbOfStone, ProbOfLife, ProbOfExit;
  74.  
  75. int ThreshTime, ThreshGrowth, ThreshStone, ThreshLife, ThreshExit;
  76.  
  77.  
  78. BYTE TurnMap[4][4] =
  79. {
  80.  { -4,  3, -1,  0},
  81.  {  1, -3,  0, -1},
  82.  { -1,  2, -4,  1},
  83.  {  2, -1,  3, -3}
  84. };
  85.  
  86.  
  87. BYTE KeyTurnMap[4] =
  88. {
  89.  3, 1, 2, 0
  90. };
  91.  
  92.  
  93. BYTE TurnRule[4][4] =
  94. {
  95.  { 0, 1, 0, 3},
  96.  { 3, 0, 1, 0},
  97.  { 0, 3, 0, 1},
  98.  { 1, 0, 3, 0}
  99. };
  100.  
  101.  
  102. BYTE InList[20][3] =
  103. {
  104.  { 20, 20, 0},
  105.  { 10, 20, 0},
  106.  { 39, 19, 3},
  107.  { 0,  1,  1},
  108.  { 39, 10, 3},
  109.  { 30, 20, 0},
  110.  { 19, 0,  2},
  111.  {  0, 10, 1},
  112.  {  0, 18, 1},
  113.  { 38, 20, 0},
  114.  {  0, 19, 1},
  115.  { 38,  0, 2},
  116.  { 18, 20, 0},
  117.  {  1,  0, 2},
  118.  {  0, 19, 1},
  119.  { 38, 20, 0},
  120.  { 37,  0, 2},
  121.  { 37, 20, 0},
  122.  { 18,  0, 2},
  123.  {  0, 18, 1},
  124. };
  125.  
  126.  
  127. BYTE OutList[20][2] =
  128. {
  129.  {  0, 10},
  130.  { 39, 4},
  131.  {  9, 20},
  132.  {  0,  1},
  133.  {  0, 10},
  134.  {  5,  0},
  135.  { 39, 10},
  136.  { 37, 20},
  137.  { 35,  0},
  138.  {  0,  1},
  139.  { 39, 19},
  140.  {  0,  5},
  141.  { 39, 10},
  142.  { 39, 10},
  143.  { 20,  0},
  144.  { 20,  0},
  145.  {  5, 20},
  146.  {  0,  1},
  147.  { 39, 19},
  148.  { 39, 19}
  149. };
  150.  
  151.  
  152. BYTE AppleList[20] =
  153. {
  154.  10, 15, 10, 10, 15,
  155.  10, 15, 7, 9, 10,
  156.  8, 10, 7, 8, 8,
  157.  10, 20, 15, 10, 15
  158. };
  159.  
  160.  
  161. BYTE ScoreNameList[8][4] =
  162. {
  163.  "STB",
  164.  "IOU",
  165.  "COD",
  166.  "DOA",
  167.  "MAD",
  168.  "KGB",
  169.  "BND",
  170.  "..."
  171. };
  172.  
  173. LONG ScoreList[8] =
  174. {
  175.  1024, 512, 256, 128, 64, 32, 16, 8
  176. };
  177.  
  178. BYTE IntroText[5][29] =
  179. {
  180.  "     Graphics & Code by     ",
  181.  "   Stefan Günter Boldorf    ",
  182.  "                            ",
  183.  "© 1990 by Stefan G. Boldorf,",
  184.  "    all rights reserved.    ",
  185. };
  186.  
  187.  
  188. BYTE HelpText[32][34] =
  189. {
  190.  "Try to eat all the apples without",
  191.  "hitting any of the walls, a stone",
  192.  "or yourself. The MAMBA will grow ",
  193.  "longer after you have eaten an   ",
  194.  "apple or a growth pill. There are",
  195.  "some extras, which will make your",
  196.  "MAMBA'S life easier, like bonus  ",
  197.  "time and lives or an extra exit! ",
  198.  
  199.  "As your MAMBA moves, it burns    ",
  200.  "calories and gets skinnier (just ",
  201.  "look! ). If you do not manage to ",
  202.  "get the apple in time, the number",
  203.  "of apples you have to eat will   ",
  204.  "increase. This does not apply if ",
  205.  "the exit has already appeared. So",
  206.  "look out for time bonuses!       ",
  207.  
  208.  "To change your MAMBA'S direction ",
  209.  "use the arrow keys or a joystick ",
  210.  "in port 2. To pause the game hit ",
  211.  "<SPACE>, to end a game hit <ESC>.",
  212.  "The special items are:           ",
  213.  "                                 ",
  214.  "   APPLE   START   FINISH   LIFE ",
  215.  "   TIME    GATE    GROWTH   STONE",
  216.  
  217.  "Some hints for easier survival:  ",
  218.  "1. Try to move along the walls to",
  219.  "   not block your own ways.      ",
  220.  "2. Do not eat time bonuses until ",
  221.  "   you need them.                ",
  222.  "3. Avoid to encircle areas with  ",
  223.  "   the MAMBA.                    ",
  224.  "       HAVE LOTS OF FUN !!!      "
  225. };
  226.  
  227.  
  228. BYTE MenuText[8][27] =
  229. {
  230.  "MAMBA MOVE SELECTION PANEL",
  231.  "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯",
  232.  "Use arrow keys or joystick",
  233.  "                          ",
  234.  "           Play Game      ",
  235.  "           Instructions   ",
  236.  "           High Scores    ",
  237.  "           Quit           "
  238. };
  239.  
  240. BYTE WaitComment[5][20] =
  241. {
  242.  "1. WAIT IF STRUCK  ",
  243.  "2. WAIT IF TURNED  ",
  244.  "3. WAIT IF MOVED   ",
  245.  "4. WAIT IF STRAIGHT",
  246.  "5. WAIT ONE MOVE   "
  247. };
  248.  
  249. BYTE ProbComments[5][18] =
  250. {
  251.  "1. PROB OF A TIME",
  252.  "2. PROB OF A PILL",
  253.  "3. PROB OF A ROCK",
  254.  "4. PROB OF A LIFE",
  255.  "5. PROB OF A EXIT"
  256. };
  257.  
  258. BYTE MambaCharSet[40] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .+-0123456789";
  259.  
  260. struct NewScreen DataScreenData =
  261. {
  262.  0,0,
  263.  120,92,4,
  264.  0,1,
  265.  NULL,
  266.  CUSTOMSCREEN,
  267.  NULL, NULL,
  268.  NULL, NULL
  269. };
  270.  
  271.  
  272. struct NewScreen ActionScreenData =
  273. {
  274.  0,0,
  275.  320,200,4,
  276.  0,1,
  277.  NULL,
  278.  CUSTOMSCREEN,
  279.  NULL, NULL,
  280.  NULL, NULL
  281. };
  282.  
  283.  
  284. struct NewWindow ActionWindowData =
  285. {
  286.  0,0,
  287.  320,200,
  288.  0,0,
  289.  NULL,
  290.  ACTIVATE | BORDERLESS | RMBTRAP | NOCAREREFRESH,
  291.  NULL, NULL,
  292.  NULL, NULL,
  293.  NULL, NULL,
  294.  NULL, NULL,
  295.  NULL,
  296.  CUSTOMSCREEN,
  297. };
  298.  
  299. UWORD MambaData[2912] = {
  300.         /* BitPlane 0 */
  301.         0xFFFF,0xFFFF,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
  302.         0x8C46,0x2791,0x8800,0x0000,0x0000,0x0000,0x0000,0x0000,
  303.         0x9245,0x2492,0x8849,0x5209,0x2092,0xA478,0x0124,0x0000,
  304.         0xA17C,0xA494,0xF8DE,0x3D1B,0xD1BC,0x7A7B,0x037A,0x0000,
  305.         0xC0E0,0x7CF8,0x187F,0x3E8F,0xE8FE,0x7D7B,0x41FD,0x0000,
  306.         0xF3E0,0x7038,0x19EB,0x97BD,0x7BD7,0x2F7B,0xE7AF,0x0000,
  307.         0x927C,0xA854,0xF9C5,0x8B3C,0xB38B,0x167A,0xC796,0x0000,
  308.         0x9245,0x2492,0x89C3,0x8738,0x7387,0x0E79,0x770E,0x0000,
  309.         0x9E46,0x2311,0x89C3,0xC7B8,0x7B87,0x8F70,0xF70F,0x0000,
  310.         0xFFFF,0xFFFF,0xF9C3,0xC7B8,0x3B87,0x8F70,0xF707,0x0000,
  311.         0xBF40,0x207F,0xF9C3,0xC7B9,0xFB87,0x8F75,0x773F,0x0000,
  312.         0xA97F,0xE63E,0x39C3,0xC7B9,0xFB87,0x8F18,0xC73F,0x0000,
  313.         0xBF55,0x711D,0x79C3,0xC7B9,0xFB87,0x8F3F,0xC73F,0x0000,
  314.         0xA97F,0xE191,0x89C3,0x8738,0x7387,0x0E17,0x870E,0x0000,
  315.         0xBF55,0x60DF,0xF9C3,0x8738,0x7387,0x0E07,0x070E,0x0000,
  316.         0xA955,0x705F,0x8800,0x0000,0x0000,0x0000,0x0000,0x0000,
  317.         0xBF7F,0xE015,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
  318.         0xA940,0x2516,0x0849,0x5209,0x23C7,0x89E0,0x3FE0,0x0000,
  319.         0xFFFF,0xFFFF,0xF8DE,0x3D17,0xB3C7,0x97E0,0xBFD0,0x0000,
  320.         0x807F,0xAFF0,0x087F,0x3E8F,0xFBC7,0x8FE2,0x6A48,0x0000,
  321.         0xF064,0xAA30,0x79EB,0x97AD,0xE387,0x8F82,0xBD86,0x0000,
  322.         0x9C5F,0xAFB1,0xD9C5,0x8B39,0xFBE7,0xBC02,0xDF96,0x0000,
  323.         0xF259,0x24F2,0x79C3,0x873E,0x7AC3,0x3822,0x58C8,0x0000,
  324.         0xBA79,0x24B2,0x59C3,0xC7BC,0x79CF,0x39E1,0x28BC,0x0000,
  325.         0xAF56,0x23B5,0x19C3,0xC7BC,0x79CE,0x3981,0x28AC,0x0000,
  326.         0xDD78,0x20F7,0xD9C3,0xC7BA,0x7966,0x3C00,0xE010,0x0000,
  327.         0xE940,0x2015,0x39C3,0xC78C,0xE0FE,0x0E20,0x2020,0x0000,
  328.         0xFFFF,0xFFFF,0xF9C3,0xC79F,0xE0FC,0x1FE0,0x1540,0x0000,
  329.         0x8C5C,0x2790,0xE9C3,0x870B,0x805A,0x0BE0,0x0880,0x0000,
  330.         0x8C5D,0x3CF2,0xE9C3,0x8703,0x803C,0x0380,0x0700,0x0000,
  331.         0xBF75,0x3B72,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
  332.         0x8C6F,0xFFFF,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
  333.         0xFFEF,0xE31F,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
  334.         0xEDF5,0x2FD2,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
  335.         0xF3DD,0x2312,0xE800,0x00F1,0x2412,0x5482,0x7800,0x0000,
  336.         0x9E5C,0x2310,0xE800,0x03F3,0x7A37,0x8F45,0xF800,0x0000,
  337.         0xFFFF,0xFFFF,0xF800,0x17F1,0xFD1F,0xCFA3,0xF800,0x0000,
  338.         0x9C43,0xA610,0x2800,0x1FF7,0xAF7A,0xE5E3,0xE000,0x0000,
  339.         0xD24D,0x3590,0x0800,0x1D07,0x9671,0x62CF,0x0000,0x0000,
  340.         0xFE57,0xE45E,0x7800,0x3807,0x0E70,0xE1CE,0x0800,0x0000,
  341.         0xD451,0x62D5,0x9800,0x3877,0x0F70,0xF1EE,0x7800,0x0000,
  342.         0xB467,0x63FF,0x2800,0x38F7,0x0770,0xF1EE,0x6000,0x0000,
  343.         0xA279,0xA535,0xA800,0x3CF7,0x3F70,0xF1EF,0x0000,0x0000,
  344.         0x9AC0,0x27F5,0xC800,0x1E77,0x3F70,0xF1E3,0x8800,0x0000,
  345.         0x8650,0x2517,0x0800,0x1FF7,0x3F70,0xF1E7,0xF800,0x0000,
  346.         0xFFFF,0xFFFF,0xF800,0x0FF7,0x0E70,0xE1C2,0xF800,0x0000,
  347.         0x9CDF,0x6793,0xC800,0x03C7,0x0E70,0xE1C0,0x0000,0x0000,
  348.         0xBEDF,0xEFD7,0x2800,0x0000,0x0000,0x0000,0x0000,0x0000,
  349.         0xBBDC,0x77FB,0x9800,0x0000,0x0000,0x0000,0x0000,0x0000,
  350.         0x9CDE,0x77BB,0x9800,0x0124,0x78F1,0x3C5D,0x0000,0x0000,
  351.         0x8EDF,0x77FB,0x9800,0x02F6,0x78F2,0xFCBD,0x8000,0x0000,
  352.         0xB7DC,0x77BB,0xD800,0x01FF,0x78F1,0xFC7F,0xC000,0x0000,
  353.         0x9FDC,0x6BD5,0xE800,0x05BC,0x70F1,0xF17B,0x0000,0x0000,
  354.         0xFFFF,0xE793,0xC800,0x073F,0x7CF7,0x81E5,0xC000,0x0000,
  355.         0xFFFF,0xFFFF,0xF800,0x07CF,0x5867,0x05C3,0xC000,0x0000,
  356.         0x8054,0xA853,0xC800,0x078F,0x39E7,0x3DCB,0xC000,0x0000,
  357.         0xA26A,0x70B7,0xA800,0x078F,0x39C7,0x31EF,0x0000,0x0000,
  358.         0x805C,0xE05B,0xD800,0x074F,0x2CC7,0x81EF,0x0000,0x0000,
  359.         0x88EA,0x605B,0x9800,0x019C,0x1FC1,0xC5EE,0x8000,0x0000,
  360.         0x8054,0xE01B,0x9800,0x03FC,0x1F83,0xFDE7,0xC000,0x0000,
  361.         0xA241,0x681B,0x9800,0x0170,0x0B41,0x7DC3,0xE000,0x0000,
  362.         0x806A,0xF435,0xA800,0x0070,0x0780,0x71C1,0xA000,0x0000,
  363.         0x88DF,0xA853,0xC800,0x0000,0x0000,0x0000,0x0000,0x0000,
  364.         0xFFFF,0xFFFF,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
  365.         0x8C5C,0x2790,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
  366.         0x8C5F,0x3CF3,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
  367.         0xB371,0x3B72,0x3800,0x0000,0x0000,0x0000,0x0000,0x0000,
  368.         0xAD6E,0xFB7D,0xD800,0x0000,0x3C3F,0x8780,0x0220,0x0000,
  369.         0xEDEE,0xEB5D,0xD800,0x0385,0x6800,0x0000,0xF434,0x0000,
  370.         0xEDF1,0x2CD2,0x3804,0xAAA0,0xD555,0x5AAA,0xAA9D,0x0000,
  371.         0xF3DF,0x2313,0xE955,0x5400,0x0000,0x0000,0x0002,0x0000,
  372.         0x9E5C,0x2310,0xE955,0x0000,0x0000,0x0000,0x0002,0x0000,
  373.         0xFFFF,0xFFFF,0xF805,0xFEAA,0x9555,0x5AAA,0xAA9D,0x0000,
  374.         0x9E5F,0x2793,0xE800,0x0385,0x6AAA,0xAD50,0xF564,0x0000,
  375.         0xAD5C,0xBCF4,0xE800,0x0000,0x3C00,0x0780,0x0220,0x0000,
  376.         0xDEF7,0x7B7B,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
  377.         0xD2ED,0xFFFE,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
  378.         0xFFED,0xF4BE,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
  379.         0xEDF7,0x77BB,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
  380.         0xF3DC,0xAB54,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
  381.         0x9E5F,0x2793,0xE800,0x0000,0x0000,0x0000,0x0120,0x0000,
  382.         0xFFFF,0xFFFF,0xF800,0x0A49,0x2444,0x4444,0x8488,0x0000,
  383.         0xBF5F,0xA797,0xE805,0x5524,0x9111,0x1112,0x4B9A,0x0000,
  384.         0xE1D0,0xFB7C,0x2985,0x55B6,0xD555,0x555B,0x5EF3,0x0000,
  385.         0xDEE7,0x733B,0x9985,0x55B6,0xD555,0x555B,0x5EF3,0x0000,
  386.         0xD2FD,0x77BA,0xF805,0x5524,0x9111,0x1112,0x4B9A,0x0000,
  387.         0xDEFD,0x74BA,0xF800,0x0A49,0x2444,0x4444,0x8488,0x0000,
  388.         0xCCE7,0x77BB,0x9800,0x0000,0x0000,0x0000,0x0120,0x0000,
  389.         0xEDD0,0xF87C,0x2800,0x0000,0x0000,0x0000,0x0000,0x0000,
  390.         0x9E5F,0xAFD7,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
  391.         0xFFFF,0xFFFF,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
  392.         /* BitPlane 1 */
  393.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  394.         0x0004,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  395.         0x0C06,0x0703,0x006B,0x560D,0x60D6,0xAC78,0x01AC,0x0000,
  396.         0x1E07,0x0707,0x0086,0x8D10,0xD10D,0x1A4B,0x821A,0x0000,
  397.         0x3F3F,0x870F,0xE081,0x4290,0x2902,0x854A,0x6205,0x0000,
  398.         0x7FBF,0xDFEF,0xE11C,0xF9A3,0x9A39,0xF34A,0x2473,0x0000,
  399.         0x1C3F,0x8FC7,0xE136,0x8D22,0xD26D,0x1A4B,0x145A,0x0000,
  400.         0x1C07,0x0783,0x0102,0x0420,0x4204,0x0849,0x9408,0x0000,
  401.         0x1C06,0x0301,0x0102,0x44A0,0x4A04,0x8940,0x9409,0x0000,
  402.         0x0000,0x0000,0x0102,0x44A0,0x4A04,0x8940,0x9409,0x0000,
  403.         0x2100,0x01AF,0xF102,0x44A1,0x0A04,0x8941,0x9421,0x0000,
  404.         0x3B3F,0xC90F,0xF102,0x44A1,0x0A04,0x8921,0x0421,0x0000,
  405.         0x212A,0x8383,0x8102,0x44A1,0xCA04,0x8920,0x0439,0x0000,
  406.         0x3B2A,0x824F,0xF102,0x0420,0x4204,0x0818,0x0408,0x0000,
  407.         0x2100,0x010F,0xF1E3,0xC7BC,0x7BC7,0x8F06,0x078F,0x0000,
  408.         0x3B2A,0x800F,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  409.         0x213F,0xD04E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  410.         0x3B00,0x088F,0xF06B,0x560D,0x63C7,0x8DE0,0x5550,0x0000,
  411.         0x0000,0x0000,0x0086,0x8D14,0x3244,0x9021,0x6AA4,0x0000,
  412.         0x0030,0x8860,0x0081,0x4290,0x1A44,0x9023,0xF532,0x0000,
  413.         0x703D,0x8EE0,0x711C,0xF9B0,0x0A04,0x91C3,0x30E4,0x0000,
  414.         0x6C28,0x88C1,0xA136,0x8D21,0x8A24,0xA203,0x17C4,0x0000,
  415.         0x4E03,0x0643,0xA102,0x0426,0x4B24,0x2123,0xB8E2,0x0000,
  416.         0x0E27,0x0703,0x0102,0x44A4,0x4908,0xA121,0xE020,0x0000,
  417.         0x412E,0x0346,0x2102,0x44A6,0x4908,0x21C1,0xE034,0x0000,
  418.         0x6338,0x00E4,0x3102,0x44A3,0x8988,0x2100,0xE030,0x0000,
  419.         0x7B00,0x0007,0x7102,0x4490,0x0081,0x1020,0x3060,0x0000,
  420.         0x0000,0x0000,0x0102,0x4490,0x0080,0x1020,0x18C0,0x0000,
  421.         0x0C1C,0x0840,0xE102,0x040C,0x0066,0x0C20,0x0F80,0x0000,
  422.         0x1223,0x1023,0x11E3,0xC783,0x803C,0x03C0,0x0700,0x0000,
  423.         0x2108,0x97A4,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
  424.         0x210C,0x5328,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,
  425.         0x4C8C,0x4848,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,
  426.         0x5E88,0x8844,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
  427.         0x40A3,0x0483,0x1000,0x02F1,0xAC1A,0xD583,0x7800,0x0000,
  428.         0x211C,0x0300,0xE000,0x0A12,0x1A21,0xA344,0x0800,0x0000,
  429.         0x0000,0x0000,0x0000,0x1012,0x0520,0x50A4,0x0800,0x0000,
  430.         0x2203,0x8600,0x2000,0x10E4,0x7347,0x3E64,0x7000,0x0000,
  431.         0x760E,0xDB80,0x2000,0x0104,0x5A4D,0xA348,0x8000,0x0000,
  432.         0x421A,0x86CE,0x5000,0x2004,0x0840,0x8108,0x4800,0x0000,
  433.         0x7414,0x034B,0xF000,0x2074,0x0940,0x9128,0x4800,0x0000,
  434.         0x2C3E,0x822A,0xA000,0x2094,0x0940,0x9128,0x7000,0x0000,
  435.         0x3629,0xC760,0x6000,0x2094,0x2140,0x9128,0x4000,0x0000,
  436.         0x1D90,0x042A,0xC000,0x1194,0x2140,0x9124,0x0800,0x0000,
  437.         0x0610,0x0747,0x0000,0x1014,0x3940,0x9124,0x0800,0x0000,
  438.         0x0000,0x0000,0x0000,0x0C14,0x0840,0x8103,0x0800,0x0000,
  439.         0x0000,0x0844,0x2000,0x03E7,0x8F78,0xF1E0,0xF000,0x0000,
  440.         0x0807,0x9028,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
  441.         0x0B04,0x01C0,0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,
  442.         0x0000,0x0000,0x8000,0x01AC,0x78F1,0xBC7F,0x0000,0x0000,
  443.         0x0807,0x01C0,0x8000,0x0286,0x4892,0x04A1,0x8000,0x0000,
  444.         0x0104,0x0000,0x0000,0x0203,0x4892,0x0480,0xC000,0x0000,
  445.         0x0304,0x13E9,0xF000,0x0601,0x4092,0x398C,0x4000,0x0000,
  446.         0x0E0C,0x0844,0x2000,0x0431,0x4494,0x4116,0x4000,0x0000,
  447.         0x0000,0x0000,0x0000,0x04C9,0x6484,0x2502,0x4000,0x0000,
  448.         0x001B,0x8FC4,0x2000,0x0489,0x2114,0x2508,0x4000,0x0000,
  449.         0x2235,0xD868,0x1000,0x04C9,0x2104,0x3928,0x4000,0x0000,
  450.         0x0023,0xD3A0,0xC000,0x0471,0x3104,0x2128,0x0000,0x0000,
  451.         0x0895,0xD220,0x8000,0x0200,0x1022,0x0528,0x8000,0x0000,
  452.         0x002B,0xD260,0x8000,0x0200,0x1002,0x0524,0xC000,0x0000,
  453.         0x223F,0xD0E0,0x8000,0x0180,0x0CC1,0x8502,0x6000,0x0000,
  454.         0x003F,0xDBE9,0x9000,0x0070,0x0780,0x79E1,0xE000,0x0000,
  455.         0x089F,0x8FC4,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,
  456.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  457.         0x0C1C,0x0840,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  458.         0x1223,0x1023,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
  459.         0x2100,0x9324,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  460.         0x210C,0x5328,0xC000,0x0000,0x3FC0,0x7F80,0x03E0,0x0000,
  461.         0x4C8C,0x4848,0xC000,0x03FA,0x9555,0x52AF,0xFA8C,0x0000,
  462.         0x4C80,0x8844,0x0007,0x5555,0xBFFF,0xF7FF,0xFF8B,0x0000,
  463.         0x40A3,0x0483,0x11AA,0xAAAA,0xAAAA,0xAAAA,0xAAA9,0x0000,
  464.         0x211C,0x0300,0xE1AA,0xAAAA,0xAAAA,0xAAAA,0xAAA9,0x0000,
  465.         0x0000,0x0000,0x0007,0x5555,0x6AAA,0xA555,0x5503,0x0000,
  466.         0x1E1F,0x0843,0xE000,0x03FA,0x9555,0x52AF,0xFA9C,0x0000,
  467.         0x3323,0x9027,0x1000,0x0000,0x3FFF,0xFF80,0x03E0,0x0000,
  468.         0x6180,0xD32C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  469.         0x6D8A,0x5029,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
  470.         0x408A,0x5B69,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
  471.         0x4C80,0xD86C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  472.         0x40A3,0x8CC7,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
  473.         0x211F,0x0783,0xE000,0x0000,0x0888,0x8880,0x01E0,0x0000,
  474.         0x0000,0x0000,0x0000,0x0ADB,0x7555,0x554D,0x8718,0x0000,
  475.         0x3F1F,0x8847,0xE005,0x5400,0x0000,0x0000,0x4C26,0x0000,
  476.         0x7FAF,0xD4AF,0xD1FA,0xAA49,0x2AAA,0xAAA4,0xA109,0x0000,
  477.         0x6D9E,0xDCED,0xE1FA,0xAA49,0x2AAA,0xAAA4,0xA109,0x0000,
  478.         0x7F83,0xDCEF,0x0005,0x5400,0x0000,0x0000,0x4C26,0x0000,
  479.         0x7383,0xDFEF,0x0000,0x0ADB,0x7555,0x554D,0x8718,0x0000,
  480.         0x739E,0xDB6D,0xE000,0x0000,0x0888,0x8880,0x01E0,0x0000,
  481.         0x52AF,0xDFEF,0xD000,0x0000,0x0000,0x0000,0x0000,0x0000,
  482.         0x211F,0x8FC7,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  483.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  484.         /* BitPlane 2 */
  485.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  486.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  487.         0x0000,0x0000,0x0077,0x6E0E,0xE0EE,0xDC00,0x01DC,0x0000,
  488.         0x0000,0x0000,0x00F9,0xF31F,0x31F3,0xE670,0x83E6,0x0000,
  489.         0x0000,0x0000,0x00FE,0xFD9F,0xD9FD,0xFB73,0xA3FB,0x0000,
  490.         0x0000,0x0000,0x01FF,0x7EBF,0xEBFE,0xFD73,0xC7FD,0x0000,
  491.         0x0000,0x0000,0x01F7,0x4EBE,0xEBEE,0x9D73,0xF7DD,0x0000,
  492.         0x0000,0x0000,0x01E3,0xC7BC,0x7BC7,0x8F71,0xE78F,0x0000,
  493.         0x0000,0x0000,0x01E3,0x873C,0x73C7,0x0E78,0xE78E,0x0000,
  494.         0x0000,0x0000,0x01E3,0x873D,0xF3C7,0x0E78,0xE7BE,0x0000,
  495.         0x3F00,0x01ED,0xF1E3,0x873D,0xF3C7,0x0E7D,0xE7BE,0x0000,
  496.         0x373F,0xC060,0x01E3,0x873D,0xF3C7,0x0E3F,0xE7BE,0x0000,
  497.         0x3F3F,0xC3AF,0x71E3,0x873D,0xF3C7,0x0E3F,0xE7BE,0x0000,
  498.         0x3715,0x43CF,0x71E3,0xC7BC,0x7BC7,0x8F1F,0xC78F,0x0000,
  499.         0x3F3F,0xC18F,0x71E3,0xC7BC,0x7BC7,0x8F07,0x078F,0x0000,
  500.         0x373F,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  501.         0x3F3F,0xC00D,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  502.         0x3700,0x000D,0xF077,0x6E0E,0xE000,0x0E00,0x6AB0,0x0000,
  503.         0x0000,0x0000,0x00F9,0xF31B,0xD387,0x1FC1,0xF57C,0x0000,
  504.         0x003F,0x8FE0,0x00FE,0xFD9F,0xEB87,0x1FC3,0xFFFE,0x0000,
  505.         0x703B,0x8DE0,0x71FF,0x7EBF,0xFBC7,0x1FE3,0xBF6A,0x0000,
  506.         0x7C37,0x8F61,0xF1F7,0x4EBF,0xF3E7,0x3E03,0x9F4A,0x0000,
  507.         0x3E3F,0x07A3,0xD1E3,0xC7BA,0x73E7,0xBDC3,0xF8FE,0x0000,
  508.         0x761F,0x07E3,0xF1E3,0x8738,0x71EF,0xBDC1,0xE03C,0x0000,
  509.         0x7F3E,0x03E7,0xF1E3,0x873A,0x71EF,0x3DE1,0xE03C,0x0000,
  510.         0x7F38,0x00E7,0xF1E3,0x873D,0xF1FF,0x3F00,0xE030,0x0000,
  511.         0x7700,0x0006,0xF1E3,0x871F,0xF0FF,0x1FC0,0x3060,0x0000,
  512.         0x0000,0x0000,0x01E3,0x871F,0xF0FE,0x1FC0,0x18C0,0x0000,
  513.         0x0C1C,0x0FC0,0xE1E3,0xC78F,0xE07E,0x0FC0,0x0F80,0x0000,
  514.         0x1E3F,0x1FE3,0xF1E3,0xC783,0x803C,0x03E0,0x0700,0x0000,
  515.         0x3F33,0x9867,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  516.         0x3F33,0xD86F,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  517.         0x61B3,0xCFCF,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  518.         0x61B3,0x8FC7,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  519.         0x7FBF,0x0783,0xF000,0x0301,0xDC1D,0xDB83,0x8000,0x0000,
  520.         0x3F1C,0x0300,0xE000,0x0DE3,0xE63E,0x7CC7,0xF000,0x0000,
  521.         0x0000,0x0000,0x0000,0x1FE3,0xFB3F,0xBF67,0xF000,0x0000,
  522.         0x3E03,0x8600,0x2000,0x1FF7,0xFD7F,0xDFA7,0xF800,0x0000,
  523.         0x6E0F,0xDF80,0x2000,0x1F07,0xDD7D,0xD3AF,0x8000,0x0000,
  524.         0x7E1D,0x47CE,0x7000,0x3C07,0x8F78,0xF1EF,0x7000,0x0000,
  525.         0x6C1F,0xC3CF,0xF000,0x3C87,0x8E78,0xE1CF,0x7000,0x0000,
  526.         0x3C3F,0xC3E5,0xE000,0x3CE7,0xBE78,0xE1CF,0x7800,0x0000,
  527.         0x3E39,0xC6EF,0xE000,0x3EE7,0xBE78,0xE1CF,0xC000,0x0000,
  528.         0x1F90,0x07EF,0xC000,0x1FE7,0xBE78,0xE1C7,0xF000,0x0000,
  529.         0x0610,0x06C7,0x0000,0x1FE7,0xBE78,0xE1C7,0xF000,0x0000,
  530.         0x0000,0x0000,0x0000,0x0FE7,0x8F78,0xF1E3,0xF000,0x0000,
  531.         0x1C1F,0x0000,0x0000,0x03F7,0x8F78,0xF1E0,0xF800,0x0000,
  532.         0x3E1F,0x8783,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  533.         0x3B1C,0x07C3,0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,
  534.         0x1C1E,0x0783,0x8000,0x01DC,0x0001,0xC063,0x0000,0x0000,
  535.         0x0E1F,0x07C3,0x8000,0x037A,0x70E3,0xF8DE,0x8000,0x0000,
  536.         0x371C,0x0783,0xC000,0x03FD,0x70E3,0xF8FF,0x4000,0x0000,
  537.         0x1F1C,0x03C1,0xE000,0x07FF,0x78E3,0xFDFF,0xC000,0x0000,
  538.         0x0E0C,0x0000,0x0000,0x07FE,0x7CE7,0xC1F7,0x8000,0x0000,
  539.         0x0000,0x0000,0x0000,0x074E,0x7CF7,0xB9E3,0x8000,0x0000,
  540.         0x0000,0x0FC0,0x0000,0x070E,0x3DF7,0xB9EF,0x8000,0x0000,
  541.         0x0000,0x18E7,0x8000,0x074E,0x3DE7,0xBDCF,0xC000,0x0000,
  542.         0x0000,0x1063,0xC000,0x07BE,0x3FE7,0xE1CF,0x8000,0x0000,
  543.         0x0000,0x1063,0x8000,0x03FE,0x1FE3,0xF9CF,0x8000,0x0000,
  544.         0x0000,0x1023,0x8000,0x03FE,0x1FC3,0xF9C7,0x4000,0x0000,
  545.         0x0000,0x1823,0x8000,0x01FC,0x0FC1,0xF9E3,0xA000,0x0000,
  546.         0x0000,0x1C61,0x8000,0x0070,0x0780,0x7DE1,0xC000,0x0000,
  547.         0x0000,0x0FC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  548.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  549.         0x0C1C,0x0FC0,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  550.         0x1E3F,0x1FE3,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  551.         0x3F33,0x9867,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  552.         0x3F33,0xD86F,0x3000,0x0000,0x3FFF,0xFF80,0x03E0,0x0000,
  553.         0x61B3,0xCFCF,0x3000,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x0000,
  554.         0x61B3,0x8FC7,0x3007,0xFFFF,0x6AAA,0xAD55,0x5517,0x0000,
  555.         0x7FBF,0x0783,0xF1FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,
  556.         0x3F1C,0x0300,0xE1FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,
  557.         0x0000,0x0000,0x0007,0xFFFF,0xFFFF,0xFFFF,0xFF9F,0x0000,
  558.         0x1E1F,0x0FC3,0xE000,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x0000,
  559.         0x3F3F,0x9FE7,0xF000,0x0000,0x3FFF,0xFF80,0x03E0,0x0000,
  560.         0x7FB3,0xD86F,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  561.         0x7FB7,0xDB6F,0xB000,0x0000,0x0000,0x0000,0x0000,0x0000,
  562.         0x6DB7,0xDFEF,0xB000,0x0000,0x0000,0x0000,0x0000,0x0000,
  563.         0x61B3,0xDFEF,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
  564.         0x7FBF,0x8FC7,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  565.         0x3F1F,0x0783,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  566.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  567.         0x3F1F,0x8FC7,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  568.         0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  569.         0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  570.         0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  571.         0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  572.         0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  573.         0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  574.         0x3F1F,0x8FC7,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  575.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  576.         /* BitPlane 3 */
  577.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  578.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  579.         0x0000,0x0000,0x007F,0x7E0F,0xE0FE,0xFC78,0x01FC,0x0000,
  580.         0x0000,0x0000,0x00FF,0xFF1F,0xF1FF,0xFE7B,0x83FE,0x0000,
  581.         0x0000,0x0000,0x00FF,0xFF9F,0xF9FF,0xFF7B,0xE3FF,0x0000,
  582.         0x0000,0x0000,0x01FF,0xFFBF,0xFBFF,0xFF7B,0xE7FF,0x0000,
  583.         0x0000,0x0000,0x01F7,0xCFBE,0xFBEF,0x9F7B,0xF7DF,0x0000,
  584.         0x0000,0x0000,0x01E3,0xC7BC,0x7BC7,0x8F79,0xF78F,0x0000,
  585.         0x0000,0x0000,0x01E3,0xC7BC,0x7BC7,0x8F78,0xF78F,0x0000,
  586.         0x0000,0x0000,0x01E3,0xC7BD,0xFBC7,0x8F78,0xF7BF,0x0000,
  587.         0x3F00,0x01E0,0x01E3,0xC7BD,0xFBC7,0x8F7D,0xF7BF,0x0000,
  588.         0x3F3F,0xCF60,0x01E3,0xC7BD,0xFBC7,0x8F3F,0xE7BF,0x0000,
  589.         0x3F3F,0xDC20,0x01E3,0xC7BD,0xFBC7,0x8F3F,0xE7BF,0x0000,
  590.         0x3F3F,0xDC00,0x01E3,0xC7BC,0x7BC7,0x8F1F,0xC78F,0x0000,
  591.         0x3F3F,0xDE40,0x01E3,0xC7BC,0x7BC7,0x8F07,0x078F,0x0000,
  592.         0x3F3F,0xDFC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  593.         0x3F3F,0xDFC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  594.         0x3F00,0x0F80,0x007F,0x7E0F,0xE3C7,0x8FE0,0x7FF0,0x0000,
  595.         0x0000,0x0000,0x00FF,0xFF1F,0xF3C7,0x9FE1,0xFFFC,0x0000,
  596.         0x003F,0x8FE0,0x00FF,0xFF9F,0xFBC7,0x9FE3,0xFFFE,0x0000,
  597.         0x703F,0x8FE0,0x71FF,0xFFBF,0xFBC7,0x9FE3,0xFFFE,0x0000,
  598.         0x7C3F,0x8FE1,0xF1F7,0xCFBF,0xFBE7,0xBE03,0xFFFE,0x0000,
  599.         0x7E3F,0x07E3,0xF1E3,0xC7BE,0x7BE7,0xBDE3,0xF8FE,0x0000,
  600.         0x7E3F,0x07E3,0xF1E3,0xC7BC,0x79EF,0xBDE1,0xE03C,0x0000,
  601.         0x7F3E,0x03E7,0xF1E3,0xC7BE,0x79EF,0x3DE1,0xE03C,0x0000,
  602.         0x7F38,0x00E7,0xF1E3,0xC7BF,0xF9FF,0x3F00,0xE030,0x0000,
  603.         0x7F00,0x0007,0xF1E3,0xC79F,0xF0FF,0x1FE0,0x3060,0x0000,
  604.         0x0000,0x0000,0x01E3,0xC79F,0xF0FE,0x1FE0,0x18C0,0x0000,
  605.         0x0C1C,0x0FC0,0xE1E3,0xC78F,0xE07E,0x0FE0,0x0F80,0x0000,
  606.         0x1E3F,0x1FE3,0xF1E3,0xC783,0x803C,0x03E0,0x0700,0x0000,
  607.         0x3F3F,0x9FE7,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  608.         0x3F3F,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  609.         0x7FBF,0xCFCF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  610.         0x7FBF,0x8FC7,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  611.         0x7FBF,0x0783,0xF000,0x03F1,0xFC1F,0xDF83,0xF800,0x0000,
  612.         0x3F1C,0x0300,0xE000,0x0FF3,0xFE3F,0xFFC7,0xF800,0x0000,
  613.         0x0000,0x0000,0x0000,0x1FF3,0xFF3F,0xFFE7,0xF800,0x0000,
  614.         0x3E03,0x8600,0x2000,0x1FF7,0xFF7F,0xFFE7,0xF800,0x0000,
  615.         0x7E0F,0xDF80,0x2000,0x1F07,0xDF7D,0xF3EF,0x8000,0x0000,
  616.         0x7E1F,0xC7CE,0x7000,0x3C07,0x8F78,0xF1EF,0x7800,0x0000,
  617.         0x7C1F,0xC3CF,0xF000,0x3CF7,0x8F78,0xF1EF,0x7800,0x0000,
  618.         0x3C3F,0xC3EF,0xE000,0x3CF7,0xBF78,0xF1EF,0x7800,0x0000,
  619.         0x3E39,0xC7EF,0xE000,0x3EF7,0xBF78,0xF1EF,0xC000,0x0000,
  620.         0x1F90,0x07EF,0xC000,0x1FF7,0xBF78,0xF1E7,0xF800,0x0000,
  621.         0x0610,0x07C7,0x0000,0x1FF7,0xBF78,0xF1E7,0xF800,0x0000,
  622.         0x0000,0x0000,0x0000,0x0FF7,0x8F78,0xF1E3,0xF800,0x0000,
  623.         0x63A0,0xCFC7,0xE000,0x03F7,0x8F78,0xF1E0,0xF800,0x0000,
  624.         0x41A0,0x586C,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
  625.         0x44A3,0xD82C,0x7000,0x0000,0x0000,0x0000,0x0000,0x0000,
  626.         0x63A1,0xD86C,0x7000,0x01FC,0x78F1,0xFC7F,0x0000,0x0000,
  627.         0x71A0,0xD82C,0x7000,0x03FE,0x78F3,0xFCFF,0x8000,0x0000,
  628.         0x48A3,0xD86C,0x3000,0x03FF,0x78F3,0xFCFF,0xC000,0x0000,
  629.         0x60A3,0xDC2E,0x1000,0x07FF,0x78F3,0xFDFF,0xC000,0x0000,
  630.         0x71B3,0xCFC7,0xE000,0x07FF,0x7CF7,0xC1F7,0xC000,0x0000,
  631.         0x0000,0x0000,0x0000,0x07CF,0x7CF7,0xBDE3,0xC000,0x0000,
  632.         0x0000,0x0007,0xE000,0x078F,0x3DF7,0xBDEF,0xC000,0x0000,
  633.         0x0000,0x0708,0x7000,0x07CF,0x3DE7,0xBDEF,0xC000,0x0000,
  634.         0x0000,0x0F8C,0x3000,0x07FF,0x3FE7,0xE1EF,0x8000,0x0000,
  635.         0x0000,0x0F8C,0x7000,0x03FE,0x1FE3,0xFDEF,0x8000,0x0000,
  636.         0x0000,0x0FCC,0x7000,0x03FE,0x1FC3,0xFDE7,0xC000,0x0000,
  637.         0x0000,0x07CC,0x7000,0x01FC,0x0FC1,0xFDE3,0xE000,0x0000,
  638.         0x0000,0x038E,0x7000,0x0070,0x0780,0x7DE1,0xE000,0x0000,
  639.         0x0000,0x0007,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
  640.         0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  641.         0x001C,0x0FC0,0xE7FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xC000,
  642.         0x003E,0x1FE1,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
  643.         0x1E3F,0x1FE3,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
  644.         0x3F3F,0x1FE3,0xF400,0x0000,0x3FFF,0xFF80,0x03E0,0x4000,
  645.         0x7FBF,0x0FC3,0xF400,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x4000,
  646.         0x7FBF,0x0783,0xF407,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
  647.         0x7FBE,0x0001,0xF5FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
  648.         0x3F1C,0x0000,0xE5FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
  649.         0x0000,0x0000,0x0407,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
  650.         0x001E,0x0FC1,0xE400,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x4000,
  651.         0x003C,0x1FE0,0xF400,0x0000,0x3FFF,0xFF80,0x03E0,0x4000,
  652.         0x003C,0x1FE0,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
  653.         0x40B8,0x1CE0,0x7400,0x0000,0x0000,0x0000,0x0000,0x4000,
  654.         0x73B8,0x1020,0x77FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xC000,
  655.         0x7FBC,0x0000,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
  656.         0x7FBC,0x0000,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
  657.         0x3F1E,0x0001,0xE400,0x0000,0x0000,0x0000,0x0000,0x4000,
  658.         0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0000,0x4000,
  659.         0x0018,0x0FC0,0x6400,0x0000,0x0000,0x0000,0x0000,0x4000,
  660.         0x0030,0x1860,0x3400,0x0000,0x0000,0x0000,0x0000,0x4000,
  661.         0x0020,0x1020,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
  662.         0x0020,0x0000,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
  663.         0x0020,0x0000,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
  664.         0x40A0,0x0000,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
  665.         0x61B0,0x0000,0x3400,0x0000,0x0000,0x0000,0x0000,0x4000,
  666.         0x3F18,0x0000,0x6400,0x0000,0x0000,0x0000,0x0000,0x4000,
  667.         0x0000,0x0000,0x07FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xC000
  668. };
  669.  
  670. struct Image MambaImage = {
  671.         0, 0,           /* LeftEdge, TopEdge */
  672.         114, 91, 4,     /* Width, Height, Depth */
  673.         &MambaData[0],  /* ImageData */
  674.         0x0F, 0x00,     /* PlanePick, PlaneOnOff */
  675.         NULL            /* NextImage */
  676. };
  677.  
  678. UWORD MambaCMap[16] = { /* Colors */
  679.         0x000,0xFDA,0xA86,0x764,0xFFF,0xF00,0xB00,0x700,
  680.         0xFF0,0xCA0,0x950,0x8F0,0x6C0,0x490,0x260,0x040
  681. };
  682.  
  683.  
  684. /* ************************ Amiga Routinen  *************************+ */
  685.  
  686. int
  687. GetUserMove()
  688. {
  689. #asm
  690.             move.w  $bfec00,d0
  691.             andi.l  #$ff,d0
  692.             lsr.w   #1,d0
  693.             bcc.s   .do_joy
  694.             cmpi    #51,d0
  695.             bhi.s   .joy_end
  696.             cmpi    #47,d0
  697.             bls.s   .joy_end
  698.             subi    #48,d0
  699.             lea     _KeyTurnMap,a0
  700.             adda.l  d0,a0
  701.             move.b  (a0),d0
  702.             bra.s   .joy_end
  703. .do_joy     move.w  $dff00c,d0
  704.             btst    #1,d0
  705.             beq.s   .next1
  706.             moveq   #1,d0
  707.             bra.s   .joy_end
  708. .next1      btst    #9,d0
  709.             beq.s   .next2
  710.             moveq   #3,d0
  711.             bra.s   .joy_end
  712. .next2      move.w  d0,d1
  713.             move.w  d0,d2
  714.             andi.w  #1,d0
  715.             andi.w  #2,d1
  716.             asr.w   #1,d1
  717.             eor.w   d0,d1
  718.             beq.s   .next3
  719.             moveq   #2,d0
  720.             bra.s   .joy_end
  721. .next3      move.w  d2,d0
  722.             move.w  d2,d1
  723.             andi.w  #256,d0
  724.             andi.w  #512,d1
  725.             asr.w   #1,d1
  726.             eor.w   d0,d1
  727.             beq.s   .next4
  728.             moveq   #0,d0
  729.             bra.s   .joy_end
  730. .next4      moveq   #5,d0
  731. .joy_end
  732. #endasm
  733. }
  734.  
  735.  
  736.  
  737. PlaySample( Data, SampleLength, SampleRate)
  738. UBYTE *Data;
  739. LONG SampleLength, SampleRate;
  740. {
  741. #asm
  742.             lea         $dff0a0,a0
  743.             move.l      8(sp),a1
  744.             move.l      a1,(a0)+
  745.             move.l      12(sp),d0
  746.             move.w      d0,(a0)+
  747.             move.l      16(sp),d0
  748.             move.w      d0,(a0)+
  749.             move.w      #64,(a0)
  750.             move.w      #$8201,$dff096
  751. #endasm
  752. }
  753.  
  754.  
  755.  
  756. StopSample()
  757. {
  758. #asm
  759.             move.w #$f,$dff096
  760. #endasm
  761. }
  762.  
  763.  
  764.  
  765. int
  766. LoadTitleSound()
  767. {
  768.  struct FileHandle *fh;
  769.  int AllOk;
  770.  
  771.  AllOk =0;
  772.  if ( fh = Open("raiders.sound", MODE_OLDFILE))
  773.    {
  774.     if ( TitleSound = AllocMem( 65500L, MEMF_CLEAR | MEMF_CHIP))
  775.       {
  776.        Read( fh, TitleSound, 65500L);
  777.        AllOk = 1;
  778.       }
  779.     Close( fh);
  780.    }
  781.  return( AllOk);
  782. }
  783.  
  784.  
  785.  
  786. UnLoadTitleSound( Really)
  787. int Really;
  788. {
  789.  if ( Really == 1)
  790.    {
  791.     StopSample();
  792.     FreeMem( TitleSound, 65500L);
  793.    }
  794. }
  795.  
  796.  
  797.  
  798. LoadHiScores()
  799. {
  800.  struct FileHandle *fh;
  801.  
  802.  if ( (fh = Open("Mamba.hiscores", MODE_OLDFILE)) != NULL)
  803.    {
  804.     Read( fh, ScoreNameList, 32);
  805.     Read( fh, ScoreList, 32);
  806.     Close( fh);
  807.    }
  808. }
  809.  
  810.  
  811.  
  812. SaveHiScores()
  813. {
  814.  struct FileHandle *fh;
  815.  
  816.  if ( (fh = Open("Mamba.hiscores", MODE_NEWFILE)) != NULL)
  817.    {
  818.     Write( fh, ScoreNameList, 32);
  819.     Write( fh, ScoreList, 32);
  820.     Close( fh);
  821.    }
  822. }
  823.  
  824.  
  825.  
  826. void
  827. Draw_Rect( rp, x0, y0, x1, y1, col)
  828. struct RastPort *rp;
  829. int x0, y0, x1, y1, col;
  830. {
  831.  SetAPen( rp, col);
  832.  RectFill( rp, x0, y0, x1, y1);
  833.  SetAPen( rp, 1);
  834. }
  835.  
  836.  
  837.  
  838. void
  839. Draw_Text( rp, x0, y0, The_Text, col)
  840. struct RastPort *rp;
  841. int x0, y0, col;
  842. BYTE *The_Text;
  843. {
  844.  SetAPen( rp, col);
  845.  Move( rp, x0, y0 +6);
  846.  Text( rp, The_Text, strlen( The_Text));
  847.  SetAPen( rp, 1);
  848. }
  849.  
  850.  
  851.  
  852. int
  853. OpenItAll()
  854. {
  855.  int fault;
  856.  
  857.  if (!(IntuitionBase = (struct IntuitionBase *)
  858.        OpenLibrary("intuition.library",0L)))
  859.    {
  860.     fault = NO_INTUI;
  861.    }
  862.  else
  863.    {
  864.     if (!(GfxBase = (struct GfxBase *)
  865.         OpenLibrary("graphics.library",0L)))
  866.       {
  867.        fault = NO_GRAFX;
  868.       }
  869.     else
  870.       {
  871.        if (!( DataScreen = (struct Screen *)
  872.            OpenScreen( &DataScreenData)))
  873.          {
  874.           fault = NO_DSCRN;
  875.          }
  876.        else
  877.          {
  878.           if (!( ActionScreen = (struct Screen *)
  879.               OpenScreen( &ActionScreenData)))
  880.             {
  881.              fault = NO_ASCRN;
  882.             }
  883.           else
  884.             {
  885.              ActionWindowData.Screen = ActionScreen;
  886.              if (!( ActionWindow = (struct Window *)
  887.                  OpenWindow( &ActionWindowData)))
  888.                {
  889.                 fault = NO_AWIND;
  890.                }
  891.              else
  892.                {
  893.                 arp = ActionWindow->RPort;
  894.                 avp = &ActionScreen->ViewPort;
  895.                 drp = &DataScreen->RastPort;
  896.                 LoadRGB4( avp, MambaCMap, 16L);
  897.                 DrawImage( drp, &MambaImage, 0, 0);
  898.                 fault = NO_FAULT;
  899.                }
  900.             }
  901.          }
  902.       }
  903.    }
  904.  return( fault);
  905. }
  906.  
  907.  
  908.  
  909. void
  910. CloseItAll( How_Much)
  911. int How_Much;
  912. {
  913.  switch( How_Much)
  914.    {
  915.     case NO_FAULT: CloseWindow( ActionWindow);
  916.     case NO_AWIND: CloseScreen( ActionScreen);
  917.     case NO_ASCRN: CloseScreen( DataScreen);
  918.     case NO_DSCRN: CloseLibrary( GfxBase);
  919.     case NO_GRAFX: CloseLibrary( IntuitionBase);
  920.    }
  921. }
  922.  
  923.  
  924.  
  925. /* ************************ Sonst. Routinen  *************************+ */
  926.  
  927.  
  928.  
  929. WaitAnyPressed()
  930. {
  931.  while( GetUserMove() == 5);
  932. }
  933.  
  934.  
  935.  
  936. WaitAnyReleased()
  937. {
  938.  while( GetUserMove() != 5);
  939. }
  940.  
  941.  
  942.  
  943. PlayTitleSound( Really)
  944. int Really;
  945. {
  946.  if ( Really == 1)
  947.    {
  948.     PlaySample( TitleSound, 32750, 400);
  949.    }
  950. }
  951.  
  952.  
  953.  
  954. void
  955. GetAlphaInput( rp, Comment, The_Text)
  956. struct RastPort *rp;
  957. BYTE *Comment, *The_Text;
  958. {
  959.  int CurrPl, TexL, CharNum, CharStart, The_Move;
  960.  BYTE CharVal, OutBuff[2];
  961.  
  962.  TexL = strlen( Comment);
  963.  CharStart = (320 - TexL*8)/2;
  964.  Draw_Text( rp, CharStart, 60, Comment, 10);
  965.  TexL = strlen( The_Text);
  966.  CharStart = (320 - TexL*8)/2;
  967.  Draw_Text( rp, CharStart, 70, The_Text, 13);
  968.  CurrPl = 0;
  969.  OutBuff[1] =0;
  970.  while ((CurrPl > -1)&&(CurrPl < TexL))
  971.    {
  972.     CharVal = The_Text[ CurrPl];
  973.     CharNum = index( MambaCharSet, CharVal) - MambaCharSet;
  974.     if (( CharNum < 0)||(CharNum > 39)) CharNum = 0;
  975.     OutBuff[0] = MambaCharSet[CharNum];
  976.     Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 11);
  977.     WaitAnyReleased();
  978.     WaitAnyPressed();
  979.     The_Move = GetUserMove();
  980.     WaitAnyReleased();
  981.     switch( The_Move)
  982.       {
  983.        case 0: if (CharNum > 0)
  984.                  {
  985.                   CharNum --;
  986.                  }
  987.                else
  988.                  {
  989.                   CharNum = 39;
  990.                  }
  991.                The_Text[ CurrPl] = MambaCharSet[ CharNum];
  992.                break;
  993.        case 1: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 13);
  994.                CurrPl ++;
  995.                break;
  996.        case 2: if (CharNum < 39)
  997.                  {
  998.                   CharNum ++;
  999.                  }
  1000.                else
  1001.                  {
  1002.                   CharNum = 0;
  1003.                  }
  1004.                The_Text[ CurrPl] = MambaCharSet[ CharNum];
  1005.                break;
  1006.        case 3: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 13);
  1007.                CurrPl --;
  1008.                break;
  1009.       }
  1010.    }
  1011. }
  1012.  
  1013.  
  1014.  
  1015. int
  1016. GetNumInput( rp, Comment, The_Data)
  1017. struct RastPort *rp;
  1018. BYTE *Comment;
  1019. int The_Data;
  1020. {
  1021.  int CurrPl, TexL, CharNum, CharStart, The_Move, The_Buff;
  1022.  BYTE CharVal, OutBuff[2], The_Text[10];
  1023.  
  1024.  The_Buff = ( The_Data < 0)? -The_Data: The_Data;
  1025.  sprintf( &The_Text[1], "%07d", The_Buff);
  1026.  The_Text[0] = (The_Data < 0)? '-': '+';
  1027.  TexL = strlen( Comment);
  1028.  CharStart = (320 - TexL*8)/2;
  1029.  Draw_Text( rp, CharStart, 60, Comment, 2);
  1030.  TexL = strlen( The_Text);
  1031.  CharStart = (320 - TexL*8)/2;
  1032.  Draw_Text( rp, CharStart, 70, The_Text, 7);
  1033.  CurrPl = 0;
  1034.  OutBuff[1] =0;
  1035.  while ((CurrPl > -1)&&(CurrPl < TexL))
  1036.    {
  1037.     CharVal = The_Text[ CurrPl];
  1038.     CharNum = index( MambaCharSet, CharVal) - MambaCharSet;
  1039.     if ((CharNum < 30)&&(CurrPl > 0)) CharNum = 30;
  1040.     if ((CharNum < 28)&&(CurrPl == 0)) CharNum = 28;
  1041.     if (CharNum > 39) CharNum = 30;
  1042.     OutBuff[0] = MambaCharSet[CharNum];
  1043.     Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 5);
  1044.     WaitAnyReleased();
  1045.     WaitAnyPressed();
  1046.     The_Move = GetUserMove();
  1047.     WaitAnyReleased();
  1048.     switch( The_Move)
  1049.       {
  1050.        case 0: if (CurrPl == 0)
  1051.                  {
  1052.                   CharNum = (CharNum == 28)?  29: 28;
  1053.                  }
  1054.                else
  1055.                  {
  1056.                   if (CharNum > 30)
  1057.                     {
  1058.                      CharNum --;
  1059.                     }
  1060.                   else
  1061.                     {
  1062.                      CharNum = 39;
  1063.                     }
  1064.                  }
  1065.                The_Text[ CurrPl] = MambaCharSet[ CharNum];
  1066.                break;
  1067.        case 1: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 7);
  1068.                CurrPl ++;
  1069.                break;
  1070.        case 2: if (CurrPl == 0)
  1071.                  {
  1072.                   CharNum = (CharNum == 28)?  29: 28;
  1073.                  }
  1074.                else
  1075.                  {
  1076.                   if (CharNum < 39)
  1077.                     {
  1078.                      CharNum ++;
  1079.                     }
  1080.                   else
  1081.                     {
  1082.                      CharNum = 30;
  1083.                     }
  1084.                  }
  1085.                The_Text[ CurrPl] = MambaCharSet[ CharNum];
  1086.                break;
  1087.        case 3: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 7);
  1088.                CurrPl --;
  1089.                break;
  1090.       }
  1091.    }
  1092.  return( atol( The_Text));
  1093. }
  1094.  
  1095.  
  1096.  
  1097. void
  1098. PlacePic( X, Y, Kind)
  1099. int X, Y, Kind;
  1100. {
  1101.  int x1, y1, x2, y2;
  1102.  
  1103.  x1 = ((Kind % 4)*9) +1;
  1104.  y1 = ((Kind / 4)*9) +1;
  1105.  x2 = X << 3;
  1106.  y2 = (Y << 3) + 32;
  1107.  ClipBlit( drp, x1, y1, arp, x2, y2, 8, 8, 0xc0);
  1108. }
  1109.  
  1110.  
  1111.  
  1112. void
  1113. DisplayScore()
  1114. {
  1115.  sprintf( &ScoreName[7],  "%06d", Score);
  1116.  sprintf( &LevelName[7],  "%3d", Level);
  1117.  sprintf( &LivesName[7],  "%3d", Lives);
  1118.  sprintf( &ApplesName[8], "%2d", Apples);
  1119.  Draw_Text( arp, 108, 0, ScoreName, 11);
  1120.  Draw_Text( arp, 80, 8, LevelName, 12);
  1121.  Draw_Text( arp, 80, 16, LivesName, 12);
  1122.  Draw_Text( arp, 80, 24, ApplesName, 12);
  1123. }
  1124.  
  1125.  
  1126.  
  1127. void
  1128. BrickLine( LeftEdge, TopEdge, BrickLength, Direction)
  1129. int LeftEdge, TopEdge, BrickLength, Direction;
  1130. {
  1131.  int x, y, t, xadd, yadd;
  1132.  
  1133.  t = 0;
  1134.  xadd = ( Direction & HORIZONTAL)? 1: 0;
  1135.  yadd = ( Direction & VERTIKAL)  ? 1: 0;
  1136.  xadd = ( Direction & REVERSE)?   -1: xadd;
  1137.  yadd = ( Direction & REVERSE)?   -1: yadd;
  1138.  x = LeftEdge;
  1139.  y = TopEdge;
  1140.  while ( t < BrickLength)
  1141.    {
  1142.     PlacePic( x, y, 7);
  1143.     PlayGround[x][y] = 2;
  1144.     x += xadd;
  1145.     y += yadd;
  1146.     t++;
  1147.    }
  1148. }
  1149.  
  1150.  
  1151.  
  1152. void
  1153. ClearYard()
  1154. {
  1155.  int k, t;
  1156.  
  1157.  Draw_Rect( arp, 8, 40, 311, 191, 0);
  1158.  for( k=1; k < 39; k++)
  1159.    for( t=1; t < 20; t++)
  1160.      PlayGround[k][t] = 0;
  1161.  BrickLine( 0, 0,  40, HORIZONTAL);
  1162.  BrickLine( 0, 20, 40, HORIZONTAL);
  1163.  BrickLine( 0,  0, 21, VERTIKAL);
  1164.  BrickLine( 39, 0, 21, VERTIKAL);
  1165. }
  1166.  
  1167.  
  1168.  
  1169. int
  1170. TurnMamba( Old, New)
  1171. int Old, New;
  1172. {
  1173.  return( (Old +New) % 4);
  1174. }
  1175.  
  1176.  
  1177.  
  1178. int
  1179. MambaInc( Value)
  1180. int Value;
  1181. {
  1182.  return( (Value +1)%400);
  1183. }
  1184.  
  1185.  
  1186.  
  1187. int
  1188. MambaDec( Value)
  1189. int Value;
  1190. {
  1191.  return(ABS((Value -1)%400));
  1192. }
  1193.  
  1194.  
  1195.  
  1196. int
  1197. MoveMamba( Direction)
  1198. int Direction;
  1199. {
  1200.  int x, y, t, k, help;
  1201.  int oldx, oldy, ancx, ancy;
  1202.  int item, time, SmplLn, OldD;
  1203.  void *Sample;
  1204.  
  1205.  time = ( Direction == 0)? 500: 300;
  1206.  NewD = TurnMamba( MambaDir, Direction);
  1207.  ancx = MambaX;
  1208.  ancy = MambaY;
  1209.  switch ( NewD)
  1210.    {
  1211.     case 0: MambaY--;
  1212.             break;
  1213.     case 1: MambaX++;
  1214.             break;
  1215.     case 2: MambaY++;
  1216.             break;
  1217.     case 3: MambaX--;
  1218.             break;
  1219.    }
  1220.  item =  PlayGround[MambaX][MambaY];
  1221.  Sample = ( item == 0)? ShakerSound: PercoSound;
  1222.  SmplLn = ( item == 0)? 1150: 2250;
  1223.  switch ( item)
  1224.    {
  1225.     case 1: Score  += 10;
  1226.             if (GrownLength < 400) GrownLength += 10;
  1227.             DisplayScore();
  1228.     case 10:
  1229.     case 11:
  1230.     case 14: if ( item == 14) if (GrownLength < 400) GrownLength += 10;
  1231.     case 15:
  1232.     case 0: PlaySample( Sample, SmplLn, time);
  1233.             if ( GrownLength <= MambaLength)
  1234.               {
  1235.                oldx = TheMamba[MambaTail][XCOORD];
  1236.                oldy = TheMamba[MambaTail][YCOORD];
  1237.                PlacePic( oldx, oldy, 24);
  1238.                PlayGround[oldx][oldy] = 0;
  1239.                MambaTail = MambaInc( MambaTail);
  1240.                oldx = TheMamba[MambaTail][XCOORD];
  1241.                oldy = TheMamba[MambaTail][YCOORD];
  1242.                OldD = TheMamba[MambaTail][DIRECT];
  1243.                PlacePic( oldx, oldy, OldD + 16);
  1244.               }
  1245.             else
  1246.               {
  1247.                MambaLength++;
  1248.               }
  1249.             PlacePic( ancx, ancy, (int)(TurnMap[MambaDir][NewD] +8));
  1250.             MambaDir = NewD;
  1251.             if ( MambaLength > 1) TheMamba[MambaDec( MambaHead)][2] = NewD;
  1252.             TheMamba[MambaHead][0] = (BYTE)MambaX;
  1253.             TheMamba[MambaHead][1] = (BYTE)MambaY;
  1254.             TheMamba[MambaHead][2] = (BYTE)MambaDir;
  1255.             PlacePic( MambaX, MambaY, 12 +MambaDir);
  1256.             PlayGround[MambaX][MambaY] = 2;
  1257.             MambaHead = MambaInc( MambaHead);
  1258.             break;
  1259.     case 13:
  1260.     case 2: Lives--;
  1261.             DisplayScore();
  1262.             PlaySample( ClapsSound, 1150, 300);
  1263.             for ( t =0; t < 7; t++)
  1264.               {
  1265.                for ( k = 0; k < 2; k++)
  1266.                  {
  1267.                   PlacePic( ancx, ancy, 28+(k<<2) +MambaDir);
  1268.                   Delay(3);
  1269.                  }
  1270.                for ( k = 2; k >= 0; k--)
  1271.                  {
  1272.                   PlacePic( ancx, ancy, 28+(k<<2) +MambaDir);
  1273.                   Delay(3);
  1274.                  }
  1275.               }
  1276.             break;
  1277.    }
  1278.  return( item);
  1279. }
  1280.  
  1281.  
  1282.  
  1283. void
  1284. SetLevel( Nr)
  1285. int Nr;
  1286. {
  1287.  ClearYard();
  1288.  if ( Nr > 20) Nr = 1;
  1289.  switch ( Nr)
  1290.    {
  1291.     case 1: break;
  1292.     case 2: BrickLine( 8, 10, 23, HORIZONTAL);
  1293.             break;
  1294.     case 3: BrickLine( 9, 10, 21, HORIZONTAL);
  1295.             BrickLine( 19, 3, 15, VERTIKAL);
  1296.             break;
  1297.     case 4: BrickLine( 4, 4, 20, HORIZONTAL);
  1298.             BrickLine( 4, 4, 10, VERTIKAL);
  1299.             BrickLine( 4, 14, 20, HORIZONTAL);
  1300.             BrickLine( 23, 4, 7, VERTIKAL);
  1301.             break;
  1302.     case 5: BrickLine( 13,  1, 7, VERTIKAL);
  1303.             BrickLine( 13, 13, 7, VERTIKAL);
  1304.             BrickLine( 25,  1, 7, VERTIKAL);
  1305.             BrickLine( 25, 13, 7, VERTIKAL);
  1306.             break;
  1307.     case 6: BrickLine(  1,  9, 10, HORIZONTAL);
  1308.             BrickLine( 10, 12, 8,  VERTIKAL);
  1309.             BrickLine( 28, 10, 11, HORIZONTAL);
  1310.             BrickLine( 28, 1, 7, VERTIKAL);
  1311.             break;
  1312.     case 7: BrickLine( 10, 4, 12,  VERTIKAL);
  1313.             BrickLine( 28, 4, 12,  VERTIKAL);
  1314.             break;
  1315.     case 8: BrickLine( 19, 1, 9,  VERTIKAL);
  1316.             BrickLine( 19, 11, 9,  VERTIKAL);
  1317.             break;
  1318.     case 9: BrickLine( 11, 1, 16,  VERTIKAL);
  1319.             BrickLine( 22, 3, 15,  VERTIKAL);
  1320.             BrickLine( 33, 4, 16,  VERTIKAL);
  1321.             break;
  1322.     case 10: BrickLine( 10,  3, 20, HORIZONTAL);
  1323.              BrickLine( 10,  3, 14, VERTIKAL);
  1324.              BrickLine( 10, 17, 10, HORIZONTAL);
  1325.              BrickLine( 20, 10,  8,  VERTIKAL);
  1326.              BrickLine( 20, 10, 10,  HORIZONTAL);
  1327.              BrickLine( 29,  7,  4,  VERTIKAL);
  1328.              break;
  1329.     case 11: BrickLine( 15,  3, 6, VERTIKAL);
  1330.              BrickLine( 25,  3, 6, VERTIKAL);
  1331.              BrickLine(  5,  8, 10, HORIZONTAL);
  1332.              BrickLine( 25,  8, 10, HORIZONTAL);
  1333.              BrickLine(  5,  8, 7, VERTIKAL);
  1334.              BrickLine( 35,  8, 7, VERTIKAL);
  1335.              BrickLine(  5, 14, 10, HORIZONTAL);
  1336.              BrickLine( 25, 14, 10, HORIZONTAL);
  1337.              BrickLine( 15, 14, 4, VERTIKAL);
  1338.              BrickLine( 25, 14, 4, VERTIKAL);
  1339.              BrickLine( 15, 18, 11, HORIZONTAL);
  1340.              break;
  1341.     case 12: BrickLine( 15,  3, 5, VERTIKAL);
  1342.              BrickLine( 25,  3, 4, VERTIKAL);
  1343.              BrickLine(  3,  7, 12, HORIZONTAL);
  1344.              BrickLine( 25,  7, 12, HORIZONTAL);
  1345.              BrickLine(  3,  7, 10, VERTIKAL);
  1346.              BrickLine( 37,  7, 11, VERTIKAL);
  1347.              BrickLine(  3, 17, 34, HORIZONTAL);
  1348.              BrickLine(  6, 12, 29, HORIZONTAL);
  1349.              break;
  1350.     case 13: BrickLine( 12,  3,  2, HORIZONTAL);
  1351.              BrickLine( 14,  3, 14, VERTIKAL);
  1352.              BrickLine( 29,  3, 14, VERTIKAL);
  1353.              BrickLine( 19,  3, 10, HORIZONTAL);
  1354.              BrickLine( 19,  9, 10, HORIZONTAL);
  1355.              BrickLine( 19, 16, 10, HORIZONTAL);
  1356.              break;
  1357.     case 14: BrickLine(  5,  3, 13, VERTIKAL);
  1358.              BrickLine( 31,  3, 13, VERTIKAL);
  1359.              BrickLine(  5,  3,  5, HORIZONTAL);
  1360.              BrickLine( 12,  3, 20, HORIZONTAL);
  1361.              BrickLine(  5,  8, 20, HORIZONTAL);
  1362.              BrickLine( 27,  8,  5, HORIZONTAL);
  1363.              BrickLine(  5, 11,  5, HORIZONTAL);
  1364.              BrickLine( 12, 11, 20, HORIZONTAL);
  1365.              BrickLine(  5, 16, 20, HORIZONTAL);
  1366.              BrickLine( 27, 16,  5, HORIZONTAL);
  1367.              break;
  1368.     case 15: BrickLine(  3,  5,  6, HORIZONTAL);
  1369.              BrickLine(  3,  5,  5, VERTIKAL);
  1370.              BrickLine(  3, 10,  5, HORIZONTAL);
  1371.              BrickLine(  8, 10,  5, VERTIKAL);
  1372.              BrickLine(  3, 15,  6, HORIZONTAL);
  1373.  
  1374.              BrickLine( 11,  5,  7, HORIZONTAL);
  1375.              BrickLine( 14,  5, 11, VERTIKAL);
  1376.  
  1377.              BrickLine( 19,  5, 11, VERTIKAL);
  1378.              BrickLine( 19,  5,  7, HORIZONTAL);
  1379.              BrickLine( 19, 15,  6, HORIZONTAL);
  1380.              BrickLine( 25, 10,  6, VERTIKAL);
  1381.  
  1382.              BrickLine( 28,  5, 11, VERTIKAL);
  1383.              BrickLine( 30,  5,  5, HORIZONTAL);
  1384.              BrickLine( 35,  5,  5, VERTIKAL);
  1385.              BrickLine( 30,  9,  5, HORIZONTAL);
  1386.              BrickLine( 30, 11,  5, HORIZONTAL);
  1387.              BrickLine( 35, 11,  5, VERTIKAL);
  1388.              BrickLine( 30, 15,  5, HORIZONTAL);
  1389.              break;
  1390.     case 16: BrickLine(  4,  4, 12, VERTIKAL);
  1391.              BrickLine( 35,  4, 12, VERTIKAL);
  1392.              BrickLine( 14,  4,  7, VERTIKAL);
  1393.              BrickLine( 25,  4,  7, VERTIKAL);
  1394.              BrickLine(  4,  4, 10, HORIZONTAL);
  1395.              BrickLine( 25,  4,  6, HORIZONTAL);
  1396.              BrickLine(  4, 16, 32, HORIZONTAL);
  1397.              BrickLine( 14, 10, 12, HORIZONTAL);
  1398.              break;
  1399.     case 17: BrickLine(  4,  8,  9, HORIZONTAL);
  1400.              BrickLine(  8,  4,  9, VERTIKAL);
  1401.              BrickLine( 27,  8,  9, HORIZONTAL);
  1402.              BrickLine( 31,  4,  9, VERTIKAL);
  1403.              BrickLine( 16, 13,  9, HORIZONTAL);
  1404.              BrickLine( 20,  9,  9, VERTIKAL);
  1405.              break;
  1406.     case 18: BrickLine( 10,  0, 16, VERTIKAL);
  1407.              BrickLine( 28,  0, 16, VERTIKAL);
  1408.              BrickLine( 19,  4, 16, VERTIKAL);
  1409.              break;
  1410.     case 19: BrickLine( 20,  3, 15, VERTIKAL);
  1411.              BrickLine(  4, 10, 33, HORIZONTAL);
  1412.              BrickLine(  5,  4,  4, HORIZONTAL);
  1413.              BrickLine(  5,  4,  4, VERTIKAL);
  1414.              BrickLine( 32,  4,  4, HORIZONTAL);
  1415.              BrickLine( 35,  4,  4, VERTIKAL);
  1416.              BrickLine( 32, 16,  4, HORIZONTAL);
  1417.              BrickLine( 35, 13,  3, VERTIKAL);
  1418.              BrickLine(  5, 16,  4, HORIZONTAL);
  1419.              BrickLine(  5, 13,  3, VERTIKAL);
  1420.              break;
  1421.     case 20: BrickLine(  3,  3, 10, HORIZONTAL);
  1422.              BrickLine(  3,  3, 15, VERTIKAL);
  1423.              BrickLine(  3, 10, 10, HORIZONTAL);
  1424.              BrickLine(  3, 17, 10, HORIZONTAL);
  1425.  
  1426.              BrickLine( 15,  3, 10, HORIZONTAL);
  1427.              BrickLine( 15,  3, 15, VERTIKAL);
  1428.              BrickLine( 24,  3, 15, VERTIKAL);
  1429.  
  1430.              BrickLine( 27,  3, 10, HORIZONTAL);
  1431.              BrickLine( 27,  3, 15, VERTIKAL);
  1432.              BrickLine( 36,  3, 15, VERTIKAL);
  1433.              BrickLine( 30, 17,  7, HORIZONTAL);
  1434.              break;
  1435.    default: BrickLine( 14,  4, 16, DIAGONAL);
  1436.             BrickLine( 14, 10, 16, HORIZONTAL);
  1437.             Nr = 16;
  1438.             break;
  1439.    }
  1440.  Nr--;
  1441.  MambaX   = InList[Nr][0];
  1442.  MambaY   = InList[Nr][1];
  1443.  MambaDir = InList[Nr][2];
  1444.  MambaLength = 1;
  1445.  MambaHead = 1;
  1446.  MambaTail = 0;
  1447.  Apples = AppleList[Nr];
  1448.  switch ( MambaDir)
  1449.    {
  1450.     case 0: MambaY--;
  1451.             break;
  1452.     case 1: MambaX++;
  1453.             break;
  1454.     case 2: MambaY++;
  1455.             break;
  1456.     case 3: MambaX--;
  1457.             break;
  1458.    }
  1459.  TheMamba[0][XCOORD] = MambaX;
  1460.  TheMamba[0][YCOORD] = MambaY;
  1461.  TheMamba[0][DIRECT] = InList[Nr][2];
  1462.  PlayGround[MambaX][MambaY] = 2;
  1463.  PlacePic( (int)(InList[Nr][0]), (int)(InList[Nr][1]), 20);
  1464. }
  1465.  
  1466.  
  1467.  
  1468. void
  1469. ResetValues( HowFar)
  1470. int HowFar;
  1471. {
  1472.  int t, k;
  1473.  
  1474.  switch ( HowFar)
  1475.    {
  1476.     case 0: Score = 0;
  1477.             Lives = 5;
  1478.             Apples = 0;
  1479.             Level = 1;
  1480.     case 1: GrownLength = 10;
  1481.             AnApple = 0;
  1482.             SetLevel( Level);
  1483.             DisplayScore();
  1484.             break;
  1485.    }
  1486. }
  1487.  
  1488.  
  1489.  
  1490. void
  1491. LookForPlace( item, ImageCode)
  1492. int item, ImageCode;
  1493. {
  1494.  int ax, ay;
  1495.  int good;
  1496.  
  1497.  good = 0;
  1498.  while ( good == 0)
  1499.    {
  1500.     ax = (int)(ran()*38) +1;
  1501.     ay = (int)(ran()*20) +1;
  1502.     if ( PlayGround[ax][ay] == 0)
  1503.       {
  1504.        good = 1;
  1505.        PlayGround[ax][ay] = item;
  1506.        PlacePic( ax, ay, ImageCode);
  1507.       }
  1508.    }
  1509. }
  1510.  
  1511.  
  1512.  
  1513. void
  1514. SetItem( zone)
  1515. int zone;
  1516. {
  1517.  int item;
  1518.  
  1519.  item = 0;
  1520.  if ( zone < ThreshLife)
  1521.    {
  1522.     item = 10;
  1523.    }
  1524.  else
  1525.    {
  1526.     if ( zone < ThreshStone)
  1527.       {
  1528.        item = 11;
  1529.       }
  1530.     else
  1531.       {
  1532.        if (zone < ThreshGrowth)
  1533.          {
  1534.           item = 13;
  1535.          }
  1536.        else
  1537.          {
  1538.           if (zone < ThreshTime)
  1539.             {
  1540.              item = 14;
  1541.             }
  1542.           else
  1543.             {
  1544.              item = 15;
  1545.             }
  1546.          }
  1547.       }
  1548.    }
  1549.  LookForPlace( item, item + 12);
  1550. }
  1551.  
  1552.  
  1553.  
  1554. void
  1555. WaitForContinue()
  1556. {
  1557.  Draw_Text( arp, 20, 171, AgainText, 8);
  1558.  while( GetUserMove() != 5);
  1559.  while( GetUserMove() == 5);
  1560. }
  1561.  
  1562.  
  1563.  
  1564. int
  1565. WaitForCheat()
  1566. {
  1567.  int t;
  1568.  
  1569.  Draw_Text( arp, 20, 171, AgainText, 8);
  1570.  while( GetUserMove() != 5);
  1571.  while( GetUserMove() == 5);
  1572.  return( GetUserMove());
  1573. }
  1574.  
  1575.  
  1576.  
  1577. ResetTime()
  1578. {
  1579.  ClipBlit( drp, 37 , 64, arp, 164, 17, 77, 14, 0xc0);
  1580.  Time_Elapsed = 0;
  1581. }
  1582.  
  1583.  
  1584.  
  1585. DisplayHiScores()
  1586. {
  1587.  BYTE OutLine[16];
  1588.  int t;
  1589.  
  1590.  ClearYard();
  1591.  Draw_Text( arp, 92, 54, HiScoreHail, 9);
  1592.  for( t=0; t < 8; t++)
  1593.    {
  1594.     strcpy( OutLine, &ScoreNameList[t][0]);
  1595.     sprintf( &OutLine[3], " %06d", ScoreList[t]);
  1596.     Draw_Text( arp, 120, 74 +t*9, OutLine, 11);
  1597.    }
  1598.  WaitForContinue();
  1599. }
  1600.  
  1601.  
  1602.  
  1603. ShowInstructions()
  1604. {
  1605.  int t, k, l;
  1606.  
  1607.  SetDrMd( arp, JAM1);
  1608.  l = 0;
  1609.  for ( k =0; k < 4; k++)
  1610.    {
  1611.     ClearYard();
  1612.     ClipBlit( drp, 37, 0, arp, 122, 56, 77, 32, 0xc0);
  1613.     for ( t =0; t < 8; t++)
  1614.       {
  1615.        Draw_Text( arp, 28, 92 +t*9, &HelpText[t +(k<<3)][0], 10);
  1616.        Draw_Text( arp, 29, 91 +t*9, &HelpText[t +(k<<3)][0], 8);
  1617.       }
  1618.     if ( k == 2)
  1619.       {
  1620.        PlacePic(  5, 14, 6);
  1621.        PlacePic( 13, 14, 20);
  1622.        PlacePic( 21, 14, 21);
  1623.        PlacePic( 30, 14, 23);
  1624.        PlacePic(  5, 15, 27);
  1625.        PlacePic( 13, 15, 22);
  1626.        PlacePic( 21, 15, 26);
  1627.        PlacePic( 30, 15, 25);
  1628.       }
  1629.     l *= 10;
  1630.     l += WaitForCheat() +1;
  1631.    }
  1632.  SetDrMd( arp, JAM2);
  1633.  if ( l == 1234) SelectWaits();
  1634.  if ( l == 1324) SelectProbs();
  1635. }
  1636.  
  1637.  
  1638.  
  1639. InitWaits()
  1640. {
  1641.  WaitIfStruck   = 2;
  1642.  WaitIfTurned   = -3;
  1643.  WaitIfMoved    = 2;
  1644.  WaitIfStraight = -1;
  1645.  WaitOneMove    = 2700;
  1646. }
  1647.  
  1648.  
  1649.  
  1650. InitProbs()
  1651. {
  1652.  ProbOfTime    = 40;
  1653.  ProbOfGrowth  = 25;
  1654.  ProbOfStone   = 23;
  1655.  ProbOfLife    = 10;
  1656.  ProbOfExit    = 5;
  1657. }
  1658.  
  1659.  
  1660.  
  1661. MakeThresh()
  1662. {
  1663.  ThreshTime   = 10000        - ProbOfTime;
  1664.  ThreshGrowth = ThreshTime   - ProbOfGrowth;
  1665.  ThreshStone  = ThreshGrowth - ProbOfStone;
  1666.  ThreshLife   = ThreshStone  - ProbOfLife;
  1667.  ThreshExit   = ThreshLife   - ProbOfExit;
  1668. }
  1669.  
  1670.  
  1671.  
  1672. GetHiScore( TheScore)
  1673. int TheScore;
  1674. {
  1675.  int ok, t, k;
  1676.  BYTE The_Name[4];
  1677.  
  1678.  ClearYard();
  1679.  strcpy( The_Name, "AAA");
  1680.  GetAlphaInput( arp, "PLEASE ENTER YOUR NAME", The_Name);
  1681.  t = 0;
  1682.  while((TheScore <= ScoreList[t])&&( t < 7))
  1683.    {
  1684.     t++;
  1685.    }
  1686.  k = 7;
  1687.  while (( k > t)&&(k > 0))
  1688.    {
  1689.     strncpy( &ScoreNameList[k][0], &ScoreNameList[k -1][0], 3);
  1690.     ScoreList[k] = ScoreList[ k -1];
  1691.     k--;
  1692.    }
  1693.  strncpy( &ScoreNameList[t][0], The_Name, 3);
  1694.  ScoreList[t] = TheScore;
  1695.  for (k =0; k < 3; k++)
  1696.    {
  1697.     if (ScoreNameList[t][k] == 0)
  1698.       {
  1699.        ScoreNameList[t][k] = 32;
  1700.       }
  1701.    }
  1702.  ScoreNameList[t][3] = 0;
  1703. }
  1704.  
  1705.  
  1706.  
  1707. SelectWaits()
  1708. {
  1709.  int WaitTimes[5];
  1710.  int l;
  1711.  
  1712.  WaitTimes[0] = WaitIfStruck;
  1713.  WaitTimes[1] = WaitIfTurned;
  1714.  WaitTimes[2] = WaitIfMoved;
  1715.  WaitTimes[3] = WaitIfStraight;
  1716.  WaitTimes[4] = WaitOneMove;
  1717.  for (l = 0; l < 5; l++)
  1718.    {
  1719.     ClearYard();
  1720.     WaitTimes[l] = GetNumInput( arp, &WaitComment[l][0], WaitTimes[l]);
  1721.    }
  1722.  WaitIfStruck   = WaitTimes[0];
  1723.  WaitIfTurned   = WaitTimes[1];
  1724.  WaitIfMoved    = WaitTimes[2];
  1725.  WaitIfStraight = WaitTimes[3];
  1726.  WaitOneMove    = WaitTimes[4];
  1727.  ClearYard();
  1728. }
  1729.  
  1730.  
  1731.  
  1732. SelectProbs()
  1733. {
  1734.  int ProbTimes[5];
  1735.  int l;
  1736.  
  1737.  ProbTimes[0] = ProbOfTime;
  1738.  ProbTimes[1] = ProbOfGrowth;
  1739.  ProbTimes[2] = ProbOfStone;
  1740.  ProbTimes[3] = ProbOfLife;
  1741.  ProbTimes[4] = ProbOfExit;
  1742.  for (l = 0; l < 5; l++)
  1743.    {
  1744.     ClearYard();
  1745.     ProbTimes[l] = GetNumInput( arp, &ProbComments[l][0], ProbTimes[l]);
  1746.    }
  1747.  ProbOfTime   = ProbTimes[0];
  1748.  ProbOfGrowth = ProbTimes[1];
  1749.  ProbOfStone  = ProbTimes[2];
  1750.  ProbOfLife   = ProbTimes[3];
  1751.  ProbOfExit   = ProbTimes[4];
  1752.  MakeThresh();
  1753.  ClearYard();
  1754. }
  1755.  
  1756.  
  1757.  
  1758. int
  1759. MambaMenu()
  1760. {
  1761.  int t, KeyStroke;
  1762.  
  1763.  KeyStroke = 7;
  1764.  while ((KeyStroke != 0)&&(KeyStroke != 3))
  1765.    {
  1766.     ClearYard();
  1767.     ClipBlit( drp, 37, 0, arp, 122, 56, 77, 32, 0xc0);
  1768.     for ( t =0; t < 8; t++)
  1769.       {
  1770.        Draw_Text( arp, 56, 96 +t*8, &MenuText[t][0], 11);
  1771.       }
  1772.     for ( t = 0; t < 4; t++)
  1773.       {
  1774.        PlacePic( 16, 12 +t, t);
  1775.       }
  1776.     WaitAnyPressed();
  1777.     KeyStroke = GetUserMove();
  1778.     WaitAnyReleased();
  1779.     switch (KeyStroke)
  1780.       {
  1781.        case 1: ShowInstructions();
  1782.                break;
  1783.        case 2: DisplayHiScores();
  1784.                break;
  1785.        case 0:
  1786.        case 3: break;
  1787.        default: KeyStroke = 7;
  1788.       }
  1789.    }
  1790.  WaitAnyReleased();
  1791.  return( (KeyStroke == 0)? 1: 0);
  1792. }
  1793.  
  1794.  
  1795.  
  1796. main()
  1797. {
  1798.  int help, t, t_continue;
  1799.  int KeyStroke, TurnJob;
  1800.  int NewLevel, DoContinue;
  1801.  int TitleFlag, OpenState;
  1802.  
  1803.  if ((OpenState = OpenItAll()) == 0)
  1804.    {
  1805.     Draw_Rect( arp, 0,0, 319, 10, 0);
  1806.     Draw_Text( arp, 167, 8, TLftText, 8);
  1807.     ClipBlit( drp, 37, 0, arp, 0,0, 77, 32, 0xc0);
  1808.     ClipBlit( drp, 37, 0, arp, 242, 0, 77, 32, 0xc0);
  1809.     BrickLine( 0, 0,  40, HORIZONTAL);
  1810.     BrickLine( 0, 20, 40, HORIZONTAL);
  1811.     BrickLine( 0,  0, 21, VERTIKAL);
  1812.     BrickLine( 39, 0, 21, VERTIKAL);
  1813.     ResetValues( 0);
  1814.     InitWaits();
  1815.     InitProbs();
  1816.     MakeThresh();
  1817.     DisplayScore();
  1818.     ResetTime();
  1819.     LoadHiScores();
  1820.     TitleFlag = LoadTitleSound();
  1821.     PlayTitleSound( TitleFlag);
  1822.     ClipBlit( drp, 37, 0, arp, 122, 56, 77, 32, 0xc0);
  1823.     for ( t =0; t < 5; t++)
  1824.       {
  1825.        Draw_Text( arp, 48, 91 + t*9, &IntroText[t][0], 12);
  1826.       }
  1827.     WaitForContinue();
  1828.     DoContinue = 1;
  1829.     while ( DoContinue == 1)
  1830.       {
  1831.        Lives = 5;
  1832.        PlayTitleSound( TitleFlag);
  1833.        DoContinue = MambaMenu();
  1834.        StopSample();
  1835.        while (( Lives >= 0)&&( DoContinue == 1))
  1836.          {
  1837.           ResetValues( 0);
  1838.           NewLevel = 1;
  1839.           while ( Lives >= 0)
  1840.             {
  1841.              if ( NewLevel == 0)
  1842.                {
  1843.                 if ( Level > 20) Level =1;
  1844.                 ResetValues( 1);
  1845.                 NewLevel = 1;
  1846.                }
  1847.              if ( AnApple == 0)
  1848.                {
  1849.                 LookForPlace( 1, 6);
  1850.                 AnApple = 1;
  1851.                 ResetTime();
  1852.                }
  1853.              if ((am = (int)(ran()*10000)) > ThreshExit)
  1854.                {
  1855.                 SetItem( am);
  1856.                }
  1857.              t = 0;
  1858.              KeyStroke = 0;
  1859.              TurnJob = 0;
  1860.              help = 0;
  1861.              while (t < WaitOneMove)
  1862.                {
  1863.                 if ( TurnJob == 0)
  1864.                   {
  1865.                    KeyStroke = GetUserMove();
  1866.                    if (( KeyStroke >= 0)&&(KeyStroke < 5))
  1867.                      {
  1868.                       TurnJob = TurnRule[MambaDir][KeyStroke];
  1869.                       if ( TurnJob == 0)
  1870.                         {
  1871.                          t += WaitIfStraight;
  1872.                         }
  1873.                       else
  1874.                         {
  1875.                          t += WaitIfTurned;
  1876.                         }
  1877.                       t += WaitIfMoved;
  1878.                      }
  1879.                    t += WaitIfStruck;
  1880.                   }
  1881.                  t++;
  1882.                 }
  1883.               Time_Elapsed++;
  1884.               if ( TurnJob == 0)
  1885.                 {
  1886.                  if (KeyStroke == 63)
  1887.                    {
  1888.                     WaitAnyReleased();
  1889.                     WaitAnyPressed();
  1890.                    }
  1891.                  else
  1892.                    {
  1893.                     if (KeyStroke == 58)
  1894.                       {
  1895.                        Lives = -1;
  1896.                       }
  1897.                    }
  1898.                }
  1899.              help = MoveMamba( TurnJob);
  1900.              switch (help)
  1901.                {
  1902.                 case 1: AnApple = 0;
  1903.                         Apples--;
  1904.                         DisplayScore();
  1905.                         if (Apples == 0)
  1906.                           {
  1907.                            PlacePic( (int)(OutList[Level -1][0]),
  1908.                                      (int)(OutList[Level -1][1]),
  1909.                                      21);
  1910.                            PlayGround[OutList[Level -1][0]]
  1911.                                      [OutList[Level -1][1]] = 5;
  1912.                            AnApple = 1;
  1913.                            ResetTime();
  1914.                           }
  1915.                         break;
  1916.                 case 5: Level ++;
  1917.                         Lives ++;
  1918.                         NewLevel = 0;
  1919.                         break;
  1920.                case 13:
  1921.                 case 2: ResetValues( 1);
  1922.                         break;
  1923.                case 10: NewLevel = 0;
  1924.                         Level++;
  1925.                         break;
  1926.                case 11: Lives++;
  1927.                         DisplayScore();
  1928.                         break;
  1929.                case 15: ResetTime();
  1930.                         break;
  1931.                }
  1932.              if ( Time_Elapsed > 154)
  1933.                {
  1934.                 Time_Elapsed = 0;
  1935.                 ClipBlit( drp, 37, 64, arp, 164, 17, 77, 14, 0xc0);
  1936.                 Apples ++;
  1937.                 DisplayScore();
  1938.                }
  1939.              else
  1940.                {
  1941.                 ClipBlit( drp, 37, 77, arp, 164, 17,(Time_Elapsed >> 1), 14,
  1942.                          0xc0);
  1943.                }
  1944.              StopSample();
  1945.             }
  1946.           ClipBlit( drp, 37, 32, arp, 122, 90, 77, 32, 0xc0);
  1947.           WaitAnyReleased();
  1948.           WaitForContinue();
  1949.           if ( Score > ScoreList[7])
  1950.             {
  1951.              GetHiScore( Score);
  1952.             }
  1953.           DisplayHiScores();
  1954.          }
  1955.       }
  1956.     UnLoadTitleSound( TitleFlag);
  1957.     SaveHiScores();
  1958.    }
  1959.  CloseItAll( OpenState);
  1960. }
  1961.  
  1962.